package com.project.personalfundmanager.shared.models;

import com.extjs.gxt.ui.client.data.BaseModel;
import com.project.personalfundmanager.client.common.Const;
import com.project.personalfundmanager.client.common.ModelHelper;
import com.project.personalfundmanager.client.listeners.Displayable;
import com.project.personalfundmanager.shared.DAOs.SectionOthersDAO;

public class SectionOthersModel extends BaseModel implements Displayable
{

	private static final long serialVersionUID = 1L;

	public SectionOthersModel( SectionOthersDAO dao )
	{
		setInfraBonds( dao.getInfraBonds() );
		setMedicalInsurance( dao.getMedicalInsurance() );
		setMedical80DD( dao.getMedical80DD() );
		setMedical80DDB( dao.getMedical80DDB() );
		setHigherStudy( dao.getHigherStudy() );
		setDonation( dao.getDonation() );
		setPhysical( dao.getPhysical() );
		setRoyalty( dao.getRoyalty() );
		setTotal( dao.getTotal() );
	}

	public static void copyToModel( SectionOthersModel fromModel, SectionOthersModel toModel )
	{
		toModel.setInfraBonds( fromModel.getInfraBonds() );
		toModel.setMedicalInsurance( fromModel.getMedicalInsurance() );
		toModel.setMedical80DD( fromModel.getMedical80DD() );
		toModel.setMedical80DDB( fromModel.getMedical80DDB() );
		toModel.setHigherStudy( fromModel.getHigherStudy() );
		toModel.setDonation( fromModel.getDonation() );
		toModel.setPhysical( fromModel.getPhysical() );
		toModel.setRoyalty( fromModel.getRoyalty() );
		toModel.setTotal( fromModel.getTotal() );
	}

	public SectionOthersModel()
	{
		setDisplayString();
	}

	public void setDisplayString()
	{
		set( "displayString", "Other Exemptions" );
	}

	public void setInfraBonds( Integer infraBonds )
	{
		set( Const.INFRA_BONDS, infraBonds );
	}

	public Integer getInfraBonds()
	{
		return ModelHelper.getNullSafeInt( get( Const.INFRA_BONDS ) );
	}

	public void setMedicalInsurance( Integer medical )
	{
		set( Const.MEDICAL_INSURANCE, medical );
	}

	public Integer getMedicalInsurance()
	{
		return ModelHelper.getNullSafeInt( get( Const.MEDICAL_INSURANCE ) );
	}

	public void setMedical80DD( Integer medical )
	{
		set( Const.MEDICAL_80DD, medical );
	}

	public Integer getMedical80DD()
	{
		return ModelHelper.getNullSafeInt( get( Const.MEDICAL_80DD ) );
	}

	public void setMedical80DDB( Integer medical )
	{
		set( Const.MEDICAL_80DDB, medical );
	}

	public Integer getMedical80DDB()
	{
		return ModelHelper.getNullSafeInt( get( Const.MEDICAL_80DDB ) );
	}

	public void setHigherStudy( Integer heigherStudy )
	{
		set( Const.HIGHER_STUDY, heigherStudy );
	}

	public Integer getHigherStudy()
	{
		return ModelHelper.getNullSafeInt( get( Const.HIGHER_STUDY ) );
	}

	public void setDonation( Integer donation )
	{
		set( Const.DONATION, donation );
	}

	public Integer getDonation()
	{
		return ModelHelper.getNullSafeInt( get( Const.DONATION ) );
	}

	public void setPhysical( Integer physical )
	{
		set( Const.PHYSICAL, physical );
	}

	public Integer getPhysical()
	{
		return ModelHelper.getNullSafeInt( get( Const.PHYSICAL ) );
	}

	public void setRoyalty( Integer royalty )
	{
		set( Const.ROYALITY, royalty );
	}

	public Integer getRoyalty()
	{
		return ModelHelper.getNullSafeInt( get( Const.ROYALITY ) );
	}

	public void setTotal( Integer total )
	{
		set( Const.SEC_OTHER_TOTAL, total );
	}

	public Integer getTotal()
	{
		return ModelHelper.getNullSafeInt( get( Const.SEC_OTHER_TOTAL ) );
	}
}
